home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initialPluginLoad.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.0 KB  |  133 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //  Creation Date:  April 1999
  18. //
  19. //  This routine contains the names of the plug-ins that contain
  20. //  functionality that is a core part of Maya.  If those plug-in
  21. //  are installed, we want to "autoload" them the first time this
  22. //  release of Maya is started.
  23. //
  24. //  If customer's subsequently decide they don't want to have
  25. //  those plug-ins autoloaded, they can disable the autoload via
  26. //  Maya's plug-in manager.
  27. //
  28. //  This code is very specific to the installation setup of a
  29. //  particular Maya release, you probably should not fiddle
  30. //  with it without consulting the release engineering team first.
  31.  
  32. global proc initialPluginLoad()
  33. {
  34.     string $mayaPlugInPath = `getenv MAYA_PLUG_IN_PATH`;
  35.     string $pluginAutoloadList[] = { };
  36.  
  37.     // List of plug-ins introduced with 3.0
  38.     if ( ! `optionVar -exists oneTimeUnlimitedPluginLoad30` ) {
  39.         optionVar -iv oneTimeUnlimitedPluginLoad30 1;
  40.  
  41.         string $licenseType = `about -p`;
  42.  
  43.         // Do not erase pre 3.0 setup if there is
  44.         // one. oneTimeUnlimitedPluginLoad was the optionvar used
  45.         // then.
  46.         if (! `optionVar -exists oneTimeUnlimitedPluginLoad` ) 
  47.         {
  48.             string $defaultPlugins[] = {
  49.                 "rotateHelper",
  50.                 "ik2Bsolver"
  51.             };
  52.             $pluginAutoloadList = AWAppendStringsToStringArray (
  53.                                     $defaultPlugins,
  54.                                     $pluginAutoloadList);
  55.  
  56.             $licenseType = match("Unlimited", $licenseType);
  57.             if ( $licenseType == "Unlimited" ) {
  58.                 string $UnlimitedPlugins[] = {
  59.                     "CpClothPlugin",
  60.                     "Fur",
  61.                     "mayalive"
  62.                 };
  63.                 $pluginAutoloadList = AWAppendStringsToStringArray (
  64.                     $UnlimitedPlugins, $pluginAutoloadList);
  65.             }
  66.         }
  67.  
  68.     }
  69.  
  70.     // List of plug-ins introduced with 5.0    
  71.     if ( ! `optionVar -exists oneTimeDefaultPluginLoad50` ) {
  72.         optionVar -iv oneTimeDefaultPluginLoad50 1;
  73.     
  74.         string $defaultPlugins[] = {
  75.             "Mayatomr",
  76.             "VectorRender"
  77.         };
  78.  
  79.         $pluginAutoloadList = AWAppendStringsToStringArray (
  80.                             $defaultPlugins,
  81.                             $pluginAutoloadList);
  82.  
  83.     }
  84.  
  85.  
  86.     if ( size($pluginAutoloadList)>0 ) {
  87.  
  88.         string $pluginPaths[];
  89.         string $extension;
  90.         string $fileName;
  91.  
  92.         if (`about -nt`) {
  93.             $extension = ".mll";
  94.             tokenize $mayaPlugInPath ";" $pluginPaths;
  95.         } else if (`about -mac`) {
  96.             $extension = ".lib";
  97.             tokenize $mayaPlugInPath ";" $pluginPaths;
  98.         } else
  99.         {
  100.             $extension = ".so";
  101.             tokenize $mayaPlugInPath ":" $pluginPaths;
  102.         }
  103.  
  104.         for ( $pluginName in $pluginAutoloadList ) {
  105.             if ( ! `pluginInfo -query -loaded $pluginName` ) {
  106.                 for ( $pluginDirectory in $pluginPaths ) {
  107.                     $fileName =   $pluginDirectory
  108.                                 + "/"
  109.                                 + $pluginName
  110.                                 + $extension;
  111.  
  112.                     // If the plug-in file exists, we will try to load it
  113.                     // Use the -r test instead of -x.  -x on Windows only
  114.                     // checks the file extension, and won't return true on
  115.                     // a file with a .mll extension.
  116.                     // delay plugin load until necessary libraries are loaded
  117.                     if ( `filetest -r $fileName` ) {
  118.                         string $cmdAutoLoad = "autoLoadPlugin(\"\", \"" 
  119.                                     + $pluginName
  120.                                     + "\", \""
  121.                                     + $pluginName
  122.                                     + "\")";
  123.                         evalDeferred($cmdAutoLoad);
  124.  
  125.                         // stop searching after we find the first match.
  126.                         break;
  127.                     }
  128.                 }
  129.             }
  130.         }
  131.     }
  132. }
  133.